<template>
	<view>
		<view  style="height: 140rpx;"></view>
		<view class="foot" >
			<view class="page-footer" id="target"  >
				<view  v-for="(item,index) in menuList" :key="index" class="foot-item"
					@click="goRouter(item)">
					<!-- <view v-if="index==2" class="middle" @click="toTarot">
						<image src="../static/images/3.png" mode=""></image>
					</view> -->
					<view  :class="index==active?'flex-col align-center justify-center acttab':'flex-col align-center justify-center' ">
						<image v-if="index==active" :src="item.img1" mode="widthFix"></image>
						<image v-else :src="item.img" mode="widthFix"></image>
						{{item.title}}
					</view>
                   
				</view>
              <!--  <view class="middle" @click="toTarot">
                    <image src="/static/images/SELL@2x.png" mode=""></image>
                </view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props: {
			active: {
				type: Number,
				default: 0,
			}
		},
		data(){
			return {
				menuList:[
                    {
                    link:"/pages/index/index",
                    img:require('../static/images/1.png'),
                    img1:require('../static/images/1-1.png'),
					title:'首页'
                    },
                    {
                    img:require('../static/images/2.png'),
                    img1:require('../static/images/2-1.png'),
                    link:"/pages/input/index",
					title:'我要报名'
                    },
					// {
					// img:require('../static/images/3.png'),
					// img1:require('../static/images/3.png'),
					// link:"/pages/tabbar/mine",
					// title:'投票'
					// },
					{
					img:require('../static/images/3.png'),
					img1:require('../static/images/3-1.png'),
					link:"/pages/vipCenter/index",
					title:'会员中心'
					},
					{
					img:require('../static/images/4.png'),
					img1:require('../static/images/4-1.png'),
					link:"/pages/my/index",
					title:'我的'
					}
                ]
			}
		},
		mounted() {
			
		},
		methods:{	
			goRouter(item) {
                console.log(item)
				var pages = getCurrentPages();
				var page = (pages[pages.length - 1]).$page.fullPath;
				if (item.link == page) return
				uni.switchTab({
					url: item.link,
					fail(err) {
						uni.redirectTo({
							url: item.link
						})
					}
				})
			},
            toTarot(){
                uni.navigateTo({
                    url:'/pages/AskQuestion/index'
                })
            }
		}
	}
	
</script>

<style lang="scss" scoped>
	.page-footer {
		position: fixed;
		bottom: 0;
		z-index: 300;
		display: flex;
		align-items: center;
		justify-content: space-around;
		width: 100%;
		height: calc(138rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
		height: calc(138rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
		box-sizing: border-box;
		
		
		box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
		// box-shadow: 3px 0px 38px 0px #000000;
		padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
		padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
            // background: rgba(0, 0, 0, 0.2);
            background: #fff;
            // border-radius: 50px 50px 0px 0px;
            // height: 100rpx;
            // box-shadow: 0px -5px 30px 0px rgba(41, 39, 130, 0.1), inset 0px 1px 0.5px 0px rgba(255, 255, 255, 0.5);
            // background-blend-mode: overlay;
            // backdrop-filter: blur(80px);
		&.filter{
			filter: blur(2rpx);
		}
		.foot-item {
			flex: 1;
			display: flex;
			width: max-content;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			position: relative;
            z-index: 99;
			height: 100%;
			font-weight: bold;
			font-size: 20rpx;
			color: #9B9BA2;
			.count-num {
				position: absolute;
				display: flex;
				justify-content: center;
				align-items: center;
				width: 40rpx;
				height: 40rpx;
				top: 0rpx;
				right: -15rpx;
				color: #fff;
				font-size: 20rpx;
				background-color: #FD502F;
				border-radius: 50%;
				padding: 4rpx;
			}
			.middle{
			    position: absolute;
			   
			    display: flex;
			    justify-content: center;
			    align-items: center;
			    top: -30rpx;
				image{
					width: 104rpx;
					height: 104rpx;
				}
			    
			}
            
		}
		.foot-item image {
			height: 44rpx;
			width: 40rpx;
			text-align: center;
			margin: 0 auto 6rpx;
			
		}
		.acttab{
			border-radius: 999px;
			background: var(--Brand-Brand1-Light, #F0F9FF);
			color: #228CFC;
			width: 166rpx;height: 80rpx;
		}
		
	}
</style>
